<style>
.fui-tag {margin-left:0.3rem}
.fui-number .minus:before, .fui-number .plus:before {
	border-left: 0 solid #d9d9d9;
}
.fui-number .minus:after, .fui-number .plus:after {
	border-right: 0 solid #d9d9d9;
}
.fui-number:before {
	border-top: 0 solid #d9d9d9;
}
.fui-number:after {border-top: 0 solid #d9d9d9;}
.fui-number .num {
	color:#666;
}
.fui-number .num {
	color:#666;
}
.fui-number.small {
	height: 1.2rem;
	width: 3.6rem;
	line-height: 1.2rem;
}
.fui-number .minus, .fui-number .plus {
	z-index:0;
}
.fui-number.small .minus{
	color: {{main.syscolor || '#63BE72'}};
	padding-top:1px;
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
 .fui-number.small .plus {
	color: #fff;
	padding-top:1px;
	background: {{main.syscolor || '#63BE72'}};
	border: 1px solid {{main.syscolor || '#63BE72'}};
	border-radius:50%;
}
</style>
<div class='fui-page fui-page-current' ng-if="pagedata.op=='main'">
	<div class="fui-content">
	<div class="weui_cells_title"><strong style="font-size: 0.8rem;">接龙内容</strong> / <small>Goo&nbsp;Jielong</small></div>
	<div class="weui_cells" style="margin-top:0" ng-repeat="item in pagedata.post.canyufileds">
            <div class="weui_cell" ng-if="item.type == 1 && item.isopen ==1">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}内容">
                </div>
            </div>
			<div class="weui_cell" ng-if="(item.type == 8 || item.type == 2) && item.isopen ==1">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}内容">
                </div>
            </div>
			<div class="weui_cell" ng-if="item.type == 3 && item.isopen ==1">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="item.data">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(item.data)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-click="up_file(item,'data','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
			</div>
			<div ng-if="item.type == 4 && item.isopen ==1" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
			<div ng-if="item.type == 4 && item.isopen ==1" class="weui_cells weui_cells_radio2">
						<label class="weui_cell weui_check_label dashed" ng-repeat="(key,value) in item.value">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%">{{value}}</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;"  ng-click="item.data=value;">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>	
				<div ng-if="item.type == 5 && item.isopen ==1" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
				<div ng-if="item.type == 5 && item.isopen ==1" class="weui_cells weui_cells_checkbox" style="padding:0.5rem">
						<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem" ng-repeat="(key,value) in item.value">
							<input type="checkbox" ng-click="duoxuans(value,item,'data')" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" value="{{key}}" id="s11"> {{value}}
						</div>
				</div>
				<div ng-if="item.type == 6 && item.isopen ==1" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
				<div ng-if="item.type == 6 && item.isopen ==1" class="weui_cells weui_cells_form">
				<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="item.data" placeholder="请输入{{item.title}}" rows="2"></textarea>
							<div class="weui_textarea_counter"><span>0</span>/118</div>
						</div>
				</div>
				</div>
				<div ng-if="item.type == 7 && item.isopen ==1" class="weui_cells_title" style="padding-left:0">{{item.title}}</div>
				<div ng-if="item.type == 7 && item.isopen ==1" class="weui_cells weui_cells_form" ng-init="pagedata.getlocation(item)">
					<div class="weui_cell">
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.province" class="form-control tpl-province">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="item.data.province==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.city" class="form-control tpl-city">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province]" value="{{value}}" ng-selected="item.data.city==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
									<select ng-model="item.data.district" class="form-control tpl-district">
									<option value="" selected="selected">区县</option>
									<option ng-repeat="(value,data) in pagedata.province[item.data.province][item.data.city]" value="{{value}}" ng-selected="item.data.district==value">{{value}}</option>
									</select>
						</div>
						<div class="fui-cell-label" style="width:28%">
									<select ng-model="item.data.street" class="form-control tpl-district">
									<option value="" selected="selected">街道</option>
									<option ng-repeat="value in pagedata.province[item.data.province][item.data.city][item.data.district]" value="{{value}}" ng-selected="item.data.street==value">{{value}}</option>
									</select>
						</div>
					</div>
					<div class="weui_cell">
						<input class="weui_input" style="padding:0" type="text" ng-model="item.data.xiangxi" placeholder="输入详细地址">
					</div>
				</div>
        </div>
		<div class="weui_cells_title"><strong style="font-size: 0.8rem;">接龙详情</strong> / <small>Goo&nbsp;Jielong</small></div>
		<div ng-repeat="item in pagedata.post.diyform">
			<div class="weui_cells weui_cells_form" ng-if="item.type == 1">
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}内容">
                </div>
            </div>
			</div>
			<div class="weui_cells weui_cells_form" ng-if="item.type == 2">
			 <div class="weui_cell" ng-if="item.type == 2">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="number" ng-model="item.data" placeholder="输入{{item.title}}内容">
                </div>
            </div>
			</div>
			<div class="weui_cells weui_cells_form" ng-if="item.type == 3">
			<div class="weui_cell">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="item.data">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(item.data)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-click="up_file(item,'data','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
			</div>
			</div>
				<div ng-if="item.type == 4" class="weui_cells_title">{{item.title}}(<span class="red">{{item.typename}}</span>)</div>
				<div ng-if="item.type == 4" class="weui_cells weui_cells_radio2" for="radio{{$index}}">
						<label class="weui_cell weui_check_label dashed" ng-repeat="tab in item.value">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%">{{tab.title}}</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;"  ng-click="item.data=tab.title;">
								<input type="radio" class="weui_check" ng-checked='item.data==tab.title'>
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>	
				<div ng-if="item.type == 5" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 5" class="weui_cells weui_cells_checkbox" style="padding:0.5rem">
						<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem" ng-repeat="(key,tab) in item.value">
							<input type="checkbox" ng-click="duoxuans(tab.title,item,'data')" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" value="{{key}}" id="s11"> {{tab.title}}
						</div>
				</div>
				<div ng-if="item.type == 6" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 6" class="weui_cells weui_cells_form">
				<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="item.data" placeholder="请输入{{item.title}}" rows="2"></textarea>
							<div class="weui_textarea_counter"><span>0</span>/118</div>
						</div>
					</div>
				</div>
				<div class="weui_cells weui_cells_form" ng-if="item.type == 11">
				<div class="weui_cell">
					<div class="weui_label" style="margin-bottom:0.3rem"><span>{{item.title}}</span></div>
					<div class="weui_cell_bd weui_cell_primary" style="">
								<ul class="weui_uploader_files" ng-if="item.data">
									  <li class="weui_uploader_file" style="width: 108px;height: 60px;background: #333;">
										<video ng-src="{{tomedia(item.data)}}" height="60" width="100%"  x5-playsinline="" playsinline="" webkit-playsinline="" preload="auto"></video>
									  </li>
								</ul>
								<div class="weui_uploader_input_wrp" ng-if="!item.data">
									 <input class="weui_uploader_input" ng-click="choose_source(item,['video','thumb'],'data')">
								</div>
					</div>
				</div>
				</div>
				<div ng-if="item.type == 7" class="weui_cells_title">{{item.title}}</div>
				<div ng-if="item.type == 7" class="weui_cells weui_cells_form" ng-init="pagedata.getlocation(item)">
					<div class="weui_cell">
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.province" class="form-control tpl-province">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="item.data.province==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.city" class="form-control tpl-city">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province]" value="{{value}}" ng-selected="item.data.city==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
									<select ng-model="item.data.district" class="form-control tpl-district">
									<option value="" selected="selected">区县</option>
									<option ng-repeat="(value,data) in pagedata.province[item.data.province][item.data.city]" value="{{value}}" ng-selected="item.data.district==value">{{value}}</option>
									</select>
								</div>
								<div class="fui-cell-label" style="width:28%">
									<select ng-model="item.data.street" class="form-control tpl-district">
									<option value="" selected="selected">街道</option>
									<option ng-repeat="value in pagedata.province[item.data.province][item.data.city][item.data.district]" value="{{value}}" ng-selected="item.data.street==value">{{value}}</option>
									</select>
								</div>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data.xiangxi" placeholder="输入详细地址">
                </div>
				</div>
        </div>
		<div class="weui_cells" ng-repeat="item in pagedata.post.fileds" >
				<div ng-if="pagedata.post.type!=3 && f.title" class="weui_cell" ng-repeat="f in item" ng-if="f.title">
						<div class="weui_cell_hd weui_cell_primary">
							<span>{{f.title}}</span>
						</div>
						<div ng-if="f.type !=18 && f.type !=3 && f.type !='option'" class="weui_cell_ft">{{f.data}}</div>
						<div ng-if="f.type ==3" class="weui_cell_ft">
							<ul class="weui_uploader_files" ng-if="f.data">
								  <li class="weui_uploader_file" style="background-image:url({{tomedia(f.data)}})"></li>
							</ul>
						</div>
						<div ng-if="f.type ==18" class="weui_cell_ft">￥<span class="price">{{f.data || '0.00'}}</span></div>
						<div ng-if="f.type =='option'" class="weui_cell_ft">
							<span class="jylabel jylabel-red" style="margin:0.2rem;line-height:1.2rem">{{f.data}}</span>
						</div>
				</div>
				<div ng-if="pagedata.post.type==3 && item.title" class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
									<div class="subtitle">
										{{item.title}}
									</div>
									<div class='price' style="line-height:1.3">		
										<span class="bigprice text-danger">￥<span class='marketprice'>{{item.price}}</span></span>
									</div>
						</div>
						<div class="weui_cell_ft">
							<div class="fui-number small r-f">
								<div class="fui-number small">
									<div class="minus" ng-click="pagedata.minus($index)">-</div>
									<input class="num shownum" type="tel" ng-model="item.total" readonly="readonly"/>
									<div class="plus " ng-click="pagedata.plus($index)">+</div>
								</div>
							</div>
						</div>
				</div>
		</div>
		<div class="weui_cells" ng-if="pagedata.post.type==6">
				<div class="weui_cell">
						<div class="weui_cell_hd weui_cell_primary">
							<span>目标金额</span>
						</div>
						<div class="weui_cell_ft">￥<span class="price">{{pagedata.post.wantmoney || '0.00'}}</span></div>
				</div>
		</div>
		<div class='fui-cell-group' ng-if="pagedata.post.type==6">
			<div class='fui-cell'>
				<div class='fui-cell-label'>接龙金额</div>
				<div class='fui-cell-info'><input class='fui-input' id='money' placeholder="请输入金额" ng-model="pagedata.post.money"></div>
			</div>
			<div class="fui-cell must noborder" style="margin-top:0;padding-top:0">
				<div class="fui-cell-text name">
							<span class="fui-tag fui-tag-red-o" ng-click="pagedata.post.money=10">10元接龙</span>
							<span class="fui-tag fui-tag-red-o" ng-click="pagedata.post.money=20">20元接龙</span>
							<span class="fui-tag fui-tag-red-o" ng-click="pagedata.post.money=30">30元接龙</span>
							<span class="fui-tag fui-tag-red-o" ng-click="pagedata.post.money=50">50元接龙</span>
							<span class="fui-tag fui-tag-red-o" ng-click="pagedata.post.money=68">68元接龙</span>
							<div class="coupon-mini" style="padding:0.5rem">快速选择一个金额接龙 <i class="icon jinyunicon icon-yuding" style="font-size:0.5rem;color:#fff"></i></div>
				</div>
			</div>
		</div>
</div>

<div class="fui-navbar" ng-if="pagedata.post.type!=6">
	<a ng-if="pagedata.post.fee>0 && pagedata.post.type!=4 && pagedata.post.type!=0" href="javascript:;" ng-click="pagedata.buypay()" class="nav-item" style="background:#00c568;color:#fff">确定接龙并付款<br><span style="font-size:0.6rem;line-height:0.8rem;margin-top:-4px">费用￥{{pagedata.post.fee || '0.00'}}</span></a>
	<a ng-if="pagedata.post.fee<=0" href="javascript:;" ng-click="post(pagedata.post,'jieli')" class="nav-item" style="background:#00c568;color:#fff">确定接龙</span></a>
</div>
<div class="fui-navbar" ng-if="pagedata.post.type==6">
	<a ng-if="pagedata.post.money>0 || pagedata.post.money>0" href="javascript:;" ng-click="pagedata.buypay()" class="nav-item" style="background:#00c568;color:#fff">确定接龙并付款<br><span style="font-size:0.6rem;line-height:0.8rem;margin-top:-4px">费用￥{{pagedata.post.money || '0.00'}}</span></a>
	<a ng-if="pagedata.post.money<=0" href="javascript:;" ng-click="post(pagedata.post,'jieli')" class="nav-item" style="background:#00c568;color:#fff">确定接龙</span></a>
</div>
</div>
<script>
scope.pagedata.buypay=function(){
	scope.post_json('/upjieli/post/',scope.pagedata.post,function(pay_id){
	var merchid=scope.pagedata.post.merchid;
		scope.tool.pay(pay_id,function(res){
			if(res.type=='success'){
				scope.message('支付成功！','success','jy_quan/feelog/');
			}else{
				scope.message('支付失败！','success','jy_quan/feelog/');
			}
		},'','','jy_quan/feelog/','jy_quan/feelog/',merchid);
	});
}
//减少
scope.pagedata.minus=function(index){
	var g = scope.pagedata.post.fileds[index]
	if(g.total<=0){
		return false;
	}
	scope.post_json('jy_quan/item/setfileds/',{'type':0,'index':index},function(res){
			g.total--;
			scope.pagedata.post.fileds[index] = g
			scope.pagedata.refresh();
			scope.$evalAsync();
	});
}
//增加
scope.pagedata.plus=function(index){
	var g = scope.pagedata.post.fileds[index]
	scope.post_json('jy_quan/item/setfileds/',{'type':1,'index':index},function(res){
			g.total++;
			scope.pagedata.post.fileds[index] = g
			scope.pagedata.refresh();
			scope.$evalAsync();
	});
}
//选择规格
scope.pagedata.setoptionid=function(optionid,index){
	scope.pagedata.refresh();
}
//刷新总数和总价
scope.pagedata.refresh=function(){
	var total=0,totalprice=0.00;
	angular.forEach(scope.pagedata.post.fileds,function(g){
		total+=parseInt(g.total);
		totalprice+=g.total*g.price;
	});
	var totalprice = totalprice.toString(); //将数字转换为字符串
	var pos_decimal = totalprice.indexOf('.'); //小数点的索引值
	 // 当整数时，pos_decimal=-1 自动补0  
	if (pos_decimal < 0) {  
			pos_decimal = totalprice.length;  
			totalprice += '.';  
	}

	// 当数字的长度< 小数点索引+2时，补0  
	while (totalprice.length <= pos_decimal + 2) {  
			totalprice += '0';  
	}  
	scope.pagedata.total=total;
	scope.pagedata.post.fee=totalprice;
}
</script>